using System.Windows.Controls;
using System.Windows;

namespace CPlatePrintSys.Win.Views
{
    /// <summary>
    /// OutputDirectoryConfigView.xaml 的交互逻辑
    /// </summary>
    public partial class OutputDirectoryConfigView : UserControl
    {
        public OutputDirectoryConfigView()
        {
            InitializeComponent();
        }

        // 添加强制刷新UI的方法
        public void RefreshUI()
        {
            this.InvalidateVisual();
        }

        // 处理TextBox失去焦点事件
        private async void TextBox_LostFocus(object sender, RoutedEventArgs e)
        {
            if (sender is TextBox textBox)
            {
                var viewModel = DataContext as ViewModels.OutputDirectoryConfigViewModel;
                if (viewModel != null)
                {
                    // 验证并保存路径
                    await viewModel.ValidateAndSavePath(textBox.Text);
                }
            }
        }
    }
} 